package com.czkevin.cif;

import de.tr7zw.nbtapi.NBTCompound;
import de.tr7zw.nbtapi.NBTContainer;

public class CIFItemInstance {

    public final CIFItem type;
    public NBTCompound data;

    public CIFItemInstance(CIFItem type) {
        this.type = type;
        this.data = null;
    }

    public CIFItemInstance(CIFItem type, NBTCompound data) {
        this.type = type;
        this.data = data;
    }

    @Override
    public CIFItemInstance clone() {
        NBTCompound clonedData;
        if(data != null) {
            clonedData = new NBTContainer();
            clonedData.mergeCompound(data);
        } else {
            clonedData = null;
        }
        return new CIFItemInstance(
            type, clonedData
        );
    }
}
